
import { Controller, Post, Body, SetMetadata } from '@nestjs/common';
import { BaseDao } from '@/common/baseDao/base.service';
import { Util } from '@/common/util/util.service';
@Controller()
export class SystemRoleController {
    dbName: string;
    constructor(
        private baseDao: BaseDao,
        private util: Util,
    ) { 
        this.dbName = 'quick-log'
    }


    @Post('/getList')
    async getList(@Body() data) {
        return await this.baseDao.getTableData({
            dbName: this.dbName,
            data,
        })
        
    }

    @Post('/add')
    async add(@Body() data) {
        console.log('data',data)
        return await this.baseDao.add({
            dbName: this.dbName,
            dataJson: data
        })
    }

    @Post('/update')
    update(@Body() data) {
        console.log('data', data)
        const {
            _id,

        } = data;
        return this.baseDao.updateById({
            id: _id,
            dbName: this.dbName,
            dataJson: {
              
            }
        })
    }

    @Post('/delete')
    async delete(@Body() data) {
        console.log('data', data)
        return await this.baseDao.del({
            dbName: this.dbName,
            whereJson: data
        })
    }
    
}